<?php


namespace App\Admin\Actions\Grid;


use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class OperateMemberVip extends RowAction
{
    protected $title = '变更会员vip信息';

    protected $model;

    public function __construct(string $model = null)
    {
        $this->model = $model;
    }

    public function render()
    {
        $form = \App\Admin\Forms\OperateMemberVip::make()->payload([
            'id'           => $this->getKey(),
            'is_vip'       => $this->row->is_vip,
            'vip_end_time' => $this->row->vip_end_time,
            'model'        => $this->model,
        ]);

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->button(<<<HTML
<a href="javascript:void(0)" style="margin-right: 5px;">vip信息</a>
HTML
            );
    }
}
